package com.compass.doctor.ui.patient.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.R
import com.compass.doctor.databinding.LayoutPatientMenuTagItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.model.Tag
import com.compass.framework.utils.getColorFromResource

/**
 * Description： 患者标签adapter
 * Date:2023/12/8 20:45
 */
class PatientMenuTagAdapter : BaseRecyclerViewAdapter<Tag, LayoutPatientMenuTagItemBinding>() {
    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutPatientMenuTagItemBinding>,
        item: Tag?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            actionText.text = item.title
            if (item.isSelect){
                actionText.setTextColor(getColorFromResource(R.color.color_5795ff))
            }else{
                actionText.setTextColor(getColorFromResource(R.color.color_2e344a))
            }
        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutPatientMenuTagItemBinding {
        return LayoutPatientMenuTagItemBinding.inflate(layoutInflater, parent, false)
    }
}